<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>组件传值</title>
		<script src="../vue@3.2.23.js"></script>
	</head>
	<body>
		<div id="app">
			<div class="count">父组件的计算器:{{count}}</div>
			<!-- 传值 静态属性传值 -->
				<!-- <counter count="30"></counter> -->
			<!-- 传值 动态属性传值 -->	
			<counter :count="count" msg="提示:确定要删除此项目吗？"></counter>
		   
		</div>
	</body>
</html>
<script>
	//局部组件
	const counter = {
		//接收
		// props:['count','msg'],
		//接受另外一种写法
		props:{
			count:{
				//数据检查类型
				type:Number,
				//自定义校验检查
				vaildator:function(val){
					return val < 100
				},
				default:60
			},
			msg:{
				type:String,
				//必传
				required:true
			}
		},
		template:
		`
		<div>子组件的计数器:{{count}}</div>
		<div>{{msg}}</div>
		`
	}
	const app = Vue.createApp({
		components:{
			counter
		},
		data(){
			return{
				count:120
			}
		}
	});
	const vm = app.mount("#app")
</script>